import NavLink from 'umi/navlink';
import withBreadcrumbs from 'react-router-breadcrumbs-hoc';

const routes = [
  { path: '/MainPage', breadcrumb: '首页' },
  { path: '/CompAbout', breadcrumb: '公司介绍' },
  { path: '/ShowCars', breadcrumb: '车辆展示' },
  { path: '/SalesNetwork', breadcrumb: '营销网络' },
  { path: '/HeavyCargo', breadcrumb: '大件运输' },
  { path: '/ConnectUs', breadcrumb: '联系我们' },
];

const Breadcrumbs = ({ breadcrumbs }) => (
  <div>
    {breadcrumbs.map(({
                        match,
                        breadcrumb,
                      },index) => (
      <span key={match.url}>
        <NavLink to={match.url}>{breadcrumb}</NavLink>
        {(index < breadcrumbs.length - 1) && <i> / </i>}
      </span>
    ))}
  </div>
);

export default withBreadcrumbs(routes)(Breadcrumbs);
